<!DOCTYPE html>
<html lang="en">
<head>
    <meta http-equiv="expires" content="Thu,01 Jan 1970 00:00:01 GMT">
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="Cache-Control" content="no-cache">
    <!--<meta http-equiv="Content-Security-Policy" content="default-src 'self';font-src 'self' data: https://fonts.gstatic.com https://fonts.googleapis.com/;style-src 'self' 'unsafe-inline'; media-src *;script-src 'self' http://api.map.baidu.com ;">-->
    <meta charset="UTF-8">
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=Edge">
    <link href="__IMG__/logo.png" rel="shortcut icon" type="image/x-icon">
    <title>花椒-辣椒-香料-调味品-附城--成都味之初农产品有限公司</title>
    <base target="_self">
    <meta name="keywords" content="成都调味品批发交易贸易，花椒，辣椒，香料，成都调味品">
    <meta name="description" content="成都味之初农产品有限公司,专注于花椒，辣椒，香料等调味品批发贸易">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    <link rel="stylesheet" href="__CSS__/bootstrap.min.css">
    <link rel="stylesheet" href="__CSS__/reset.css">
    <link rel="stylesheet" href="__CSS__/address.css">
    <link rel="stylesheet" href="__CSS__/common.css">
    <link rel="stylesheet" href="__CSS__/prod.css">
    <script>
        var _hmt = _hmt || [];
        (function() {
            var hm = document.createElement("script");
            hm.src = "https://hm.baidu.com/hm.js?68cca1e88d91513304d45edd3b72a6ba";
            var s = document.getElementsByTagName("script")[0];
            s.parentNode.insertBefore(hm, s);
        })();
    </script>
</head>
<body>
    <top class="prod-huajiao">
        <header class="navbar navbar-default">
            <div class="login-reg">
                {include file="index@base/status"}

            </div>
            <div class="container">
                <!--小屏幕导航按钮和logo-->
                <div class="navbar-header">
                    <button class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
                        <span class="icon-bar"></span>
                        <span class="icon-bar"></span>
                        <span class="icon-bar"></span>
                    </button>
                    <div id="logo-part-for-mobile" style="display: none;">
                        <a href="http://cdweizhichu.com/">
                            <img src="__IMG__/logo.png" class="logo">
                            <span>附城</span>
                        </a>
                    </div>
                </div>
                <!--小屏幕导航按钮和logo-->
                <!--导航-->

                <div class="navbar-collapse collapse">
                    <div id="logo-part-for-pc">
                        <h1 style="display: inline-block;">
                            <a href="http://cdweizhichu.com/" style="display: block">
                                <img src="__IMG__/logo.png" class="logo">
                                <span class="logo-right-txt">附城</span>
                            </a>
                        </h1>
                    </div>
                    <ul id="main-navigation" class="nav navbar-nav">
                        <li>

                            <a href="/">附城</a>

                        </li>
                        <li >
                            <a href="/index/index/huajiao">花椒</a>
                        </li>
                        <li class="">

                            <a href="/index/index/lajiao">辣椒</a>

                        </li>
                        <li class="">

                            <a href="/index/index/xiangliao">香料</a>

                        </li>
                        <li class="prod-center active">

                            <a href="#">产品中心<i class="nav-arrow-up"></i></a>

                            <ul>
                                <li><a href="/index/index/prodhuajiao" style="background: #CE7D3A;color: #fff;">花椒产品</a></li>
                                <li><a href="/index/index/prodlajiao">辣椒产品</a></li>
                                <li><a href="/index/index/prodxiangliao">香料产品</a></li>
                                <li><a href="/index/index/prodquality">精品展示</a></li>
                            </ul>
                        </li>
                        <li class="">

                            <a href="./news.html">最新资讯</a>

                        </li>
                        <li class="">

                            <a href="./story.html">故事欣赏</a>

                        </li>
                    </ul>
                </div>
                <!--导航-->
            </div>
        </header>
    </top>
    <div class="details">
        <div class="details-title">产品详情</div>
        <div class="tips-info">已进入详情页面：<span>{$goods.good_name}</span></div>
        <div class="row">
            <div class="col-md-6 col-xs-12">
                <div class="prod-v-line" id="demo">
                    <div class="showProd" id="small-box">
                        <div id="mark"></div>
                        <div id="float-box"></div>
                        <img src="{$goods.good_img}" alt="">
                    </div>
                    <div id="big-box">
                        <img src="{$goods.good_img}" alt="">
                    </div>
                    <ul class="showBotPic">
                        <li><img src="{$goods.good_img}" alt=""></li>
                        <!--<li><img src="__IMG__/4299ad2f5d0b20dfb7c680bb91be753c.jpg" alt=""></li>-->
                        <!--<li><img src="__IMG__/4acd502102c17c76e8051280cea6e3f0.jpg" alt=""></li>-->
                        <!--<li><img src="__IMG__/8f365bbb327fc957bcec3ddedc06069e.jpg" alt=""></li>-->
                    </ul>
                </div>
            </div>
            <div class="col-md-6 col-xs-12 prod-right-H">
                <div class="prod-right-cont-wrapper">
                    <div class="prod-part-right">
                        <div class="name"><!--产品名称：--><span>{$goods.good_name}</span></div>
                        <div class="prod_describe">产品描述字段。。。。</div>
                        <div class="prod-infos">
                            <div class="prod-top-bg">
                                <span class="prod-label label-price">价格</span>
                                <span class="price">￥<span class="price-num">{$goods.good_price}</span></span>
                                <span class="special">
                                    <span class="front-point"></span>
                                    特别推荐
                                </span>
                            </div>
                            <div class="prod-bot-bg">
                                <div>
                                    <span class="prod-label">重量</span>
                                    <span class="weight">{$goods.good_weight}</span>
                                </div>
                                <div class="mar10">
                                    <span class="prod-label">生产地</span>
                                    <span class="yieldly">{$goods.good_origin}</span>
                                </div>
                                <div>
                                    <span class="prod-label">保存条件</span>
                                    <span class="temperature">(0-5℃)</span>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="bot-amount">
                        <span>数量</span>
                        <span class="count-input-part">
                        <span class="minus">-</span>
                        <span><input type="text" class="count-input" value="1"></span>
                        <span class="add">+</span>
                    </span>
                        <span>件</span>
                        <span>(库存<span class="inventory">{$goods.good_repertory}</span>)件</span>
                    </div>
                    <ul class="option-tab">
                        <li class="buy-now" data-toggle="" data-target=".bs-example-modal-lg">立即购买</li>
                        <!--<li class="join-cart">
                            <img src="__IMG__/cart.png" alt="">
                            加入购物车
                        </li>
                        <li class="collect">
                            <img src="__IMG__/star-white.png" alt="">
                            收藏此商品
                        </li>-->
                    </ul>
                </div>
            </div>
        </div>

        <div class="other-prod">
            <div class="other-title">其他相关产品推荐</div>
            <div class="row pad20">
                <div class="col-md-3 col-xs-3 recommend-wrapper">
                    <div class="look-before">浏览历史</div>
                    <div class="recommend"><a href=""><img src="" alt=""></a></div>
                    <div class="recommend"><a href=""><img src="" alt=""></a></div>
                    <div class="recommend"><a href=""><img src="" alt=""></a></div>
                </div>
                <a href=""></a>
                <div class="col-md-9 col-xs-9 nopad rec-right">
                    <div class="rec-right-H">

                    </div>
                </div>
            </div>
        </div>
    </div>


    {include file="/common" /}

    <!--user part-->
    {include file="index@base/userinfo"}


    <!--地区模态框-->
    <div id="addressSelectWrapper">
        <div id="addressSelect">
            <div class="tip">
                <h3>所在地区</h3>
                <button type="button" id="cancel"></button>
            </div>
            <div id="address">
                <ul class="selected-address">
                    <li class="lastarea" id="lastprovince">请选择</li>
                    <li class="lastarea" id="lastcity">请选择</li>
                    <li class="lastarea" id="lastarea">请选择</li>
                    <li class="lastarea" id="lasttown">请选择</li>
                </ul>
                <div class="address-content">
                    <ul id="province"></ul>
                    <ul id="city"></ul>
                    <ul id="area"></ul>
                    <ul id="town"></ul>
                </div>
            </div>
        </div>
    </div>
    <div id="outerdiv" style="position:fixed;top:0;left:0;background:rgba(0,0,0,0.7);z-index:2;width:100%;height:100%;display:none;">
        <div id="innerdiv" style="position:absolute;">
            <img id="bigimg" style="border:5px solid #fff;" src="" />
        </div>
    </div>
</body>
<script src="__JS__/jQuery-1.11.1.min.js"></script>
<script src="__JS__/bootstrap.min.js"></script>
<script src="__JS__/city.js"></script>
<script src="__JS__/address-check.js"></script>
<script>
    (function(){
        var bp = document.createElement('script');
        var curProtocol = window.location.protocol.split(':')[0];
        if (curProtocol === 'https') {
            bp.src = 'https://zz.bdstatic.com/linksubmit/push.js';
        }
        else {
            bp.src = 'http://push.zhanzhang.baidu.com/push.js';
        }
        var s = document.getElementsByTagName("script")[0];
        s.parentNode.insertBefore(bp, s);
    })();
</script>
<script>
    $(function () {
        $('.user-fixed-right').mouseenter(function () {
            $(this).css({right:0,height:'200px',background:'#3A394D',borderColor: '#333',borderRadius:0,transition:'all .3s ease-out'})
            $('.user-edit').show()
        }).mouseleave(function () {
            $(this).css({right:'-50px',height:'100px',background:'#fff',borderColor: '#efa123',borderRadius:'50%',transition:'all .3s ease-out'})
            $('.user-edit').hide()
        })
    })
</script>
<script>
    $(function(){
        // 地址选择器遮罩层打开与关闭
        $("#areaLabel").click(function(e){
            $("#addressSelectWrapper").show();
            e.stopPropagation();
        });
        $(document).click(function () {
            $("#addressSelectWrapper").hide();
        });
        $("#cancel").click(function () {
            $("#addressSelectWrapper").hide();
        });
        $("#addressSelect").click(function (e) {
            e.stopPropagation();
        });

        initAddress();
    });

    //初始化地址选择
    function initAddress() {
        $("#Addr").cityLinkage({
            containerId: 'addressSelectWrapper',
            getSelectedCode:function(){return $("#Addr").data("code");},
            callback:function(data) {
                $("#Addr").val(data.addr).data("code",data.town.code);
            }
        });
    }
</script>
<script>
    $(function () {
        setTimeout(function () {
            $('.showBotPic img').height($('.showBotPic li:eq(0) img').height())
            $('.prod-right-H').height($('.prod-v-line').outerHeight())
            $('.prod-right-cont-wrapper').css({transform: 'translateY(-50%)'})

            $('.rec-right-H').show()
        },800)

        //放大镜相关盒子
        var _imgWidth = $('.showProd img').width(),
            _imgHeight = $('#small-box img').height()
        $('#mark,#small-box,.showProd img').css({width:_imgWidth+'px',height:_imgHeight+'px'})
        $('.showBotPic li img').on('mouseover',function () {
            $('.showProd img')[0].src = $(this)[0].src
            $(this).css({border:'3px solid #000'})
        }).on('mouseout',function () {
            $(this).css({border:'none'})
        })

        $('.prod-center').mouseenter(function () {
            $(this).find('ul').show()
            $(this).find('.nav-arrow-up').css({transform:'translateY(-20%) rotate(315deg)',transition:'all .35s ease-in-out'})
        }).mouseleave(function () {
            $(this).find('.nav-arrow-up').css({transform:'translateY(-50%) rotate(135deg)'})
        })

        $('.prod-center ul').mouseenter(function () {
            $(this).siblings('a').find('.nav-arrow-up').css({transform:'translateY(-20%) rotate(315deg)'})
        })
        .mouseleave(function () {
            $(this).hide()
            $(this).siblings('a').find('.nav-arrow-up').css({transform:'translateY(-50%) rotate(135deg)'})
        })

        /*数量输入、加减*/
        $('.minus').on('click',function () {
            var count = $(this).siblings().find('.count-input').val()
            count--
            if(count < 1){
                count = 1
            }
            $(this).siblings().find('.count-input').val(count)
        })
        $('.add').on('click',function () {
            var count = $(this).siblings().find('.count-input').val()
            var inventory = $('.inventory').html()
            count++
            if(count > inventory){
                count = inventory
            }
            $(this).siblings().find('.count-input').val(count)
        })

        //限制商品数量字符输入
        var reg = /[^0-9]/g
        $('.count-input').on('keydown',function (ev) {
            $(this).val($(this).val().replace(reg,''))  //避免按住某个非数字键不放，持续输入
        }).on('keyup',function (ev) {
            $(this).val($(this).val().replace(reg,''))  //避免按住某个非数字键不放，持续输入
            if($(this).val().substr(0,1) === '0') {
                $(this).val(1)
            }
        })

        //商品数量至少为1
        $('.count-input').on('blur',function(){
            var inventory = parseInt($('.inventory').html())
            if(!$(this).val()) {
                $(this).val(1)
            }else {
                $(this).val($(this).val().replace(reg,''))
                if(!$(this).val()) {
                    $(this).val(1)
                }
                if($(this).val() >= inventory) {
                    $(this).val(inventory)
                    var g_inventory = {inventory: inventory}
                    sessionStorage.setItem('inventorytoMax',JSON.stringify(g_inventory))
                }/*else {
                    sessionStorage.removeItem('inventorytoMax')
                }*/
            }
        })

        /*获取信息*/
        var good_id = window.location.href.split('good_id=')[1]


        /*立即购买*/
        /*检验是否登录*/
        $('.buy-now').on('click',function () {
            var g_info = {
                good_name: $('.prod-part-right .name span')[0].innerText,
                good_count: $('.count-input').val(),
                good_s_price: $('.price-num')[0].innerText
            }
            var inventory = parseInt($('.inventory').html())
            var g_inventory = {inventory: inventory}
            sessionStorage.setItem('inventorytoMax',JSON.stringify(g_inventory))
            sessionStorage.setItem('good_info',JSON.stringify(g_info))
            window.location.href = '/index/order/postorder.html?good_id='+good_id

        })


        /*浏览历史*/
        $.post('/index/goods/getHistory',function (res) {
            if(res) {
                for(var i=0;i<res.rows.length;i++) {
                    $('.recommend-wrapper a')[i].href= `./proddetails.html?good_id=${res.rows[i].good_id}`
                    $('.recommend-wrapper img')[i].src= res.rows[i].good_img
                }
                // $('.rec-right').height($('.recommend-wrapper').height())
                $('.rec-right').height(615)
                if(res.rows.length < 3) {
                    $('.recommend-wrapper').height($('.rec-right').height())
                }
                if(window.screen.width < 500) {
                    $('.rec-right').height(470)
                    $('.recommend-wrapper').height(470)
                }
            }
        },'json')

        /*相关推荐*/
        $.post('/index/goods/getHots',function (res) {
            if(res) {
                var data = res.rows
                for(var i=0;i<data.length;i++) {
                    $('.rec-right-H').append('<div class="col-md-4 col-xs-6">\n' +
                        '                            <img src="'+data[i].good_img+'" alt="">\n' +
                        '                            <div class="rec-prod">\n' +
                        '                                <div class="rec-name">\n' +
                        '                                    '+data[i].good_name+'\n' +
                        '                                </div>\n' +
                        '                                <a href="./proddetails.html?good_id='+data[i].good_id+'">查看详情</a>\n' +
                        '                            </div>\n' +
                        '                        </div>')
                }
                var naturalImg = $('.rec-right-H img')[0]
                if(screen.width > 1600) {
                    $('.rec-right').height('850px')
                }
                setTimeout(function () {
                    $('.rec-right-H img:eq(0)').css({height: screen.width < 500 ? '85px':
                            parseInt($('.rec-right-H img:eq(0)').width() / naturalImg.naturalWidth * naturalImg.naturalHeight) + 'px'
                    })

                    $('.rec-right-H img:gt(0)').height($('.rec-right-H img:eq(0)').height())
                },800)
            }
        },'json')


        /*保存收货地址信息*/
        $('#save').on('click',function () {

            checkAll()

            var cons_area = $('#Addr').val().split('/ ')
            cons_area[3] = cons_area[3] ? cons_area[3] : ''
            cons_area = cons_area[0]+cons_area[1]+cons_area[2]+cons_area[3]
            $.post('/index/member/editAddress',{
                memb_city : cons_area,
                memb_address : $('#detailAddr').val(),
                memb_zipCode : $('#postCode').val(),
                memb_addrName : $('#consigneeName').val(),
                memb_addrPhone : $('#phone').val(),
                // cons_default: $('#setDefault')[0].checked //设为默认收货地址
            },function (res) {
                if(res.code === 1) {
                    window.location.href = 'postorder.html?good_id='+good_id
                }
            },'json')
        })

        if(window.screen.width < 500) {
            $('ul.showBotPic').hide()
            $('.prod-right-H').css({height: '400px',marginTop:'25px'})
            $('.prod-v-line').height(300)
            $('.prod-v-line').css({border:'none'})
            var prodUl = true
            $('.prod-center>a').on('click',function () {
                if(prodUl) {
                    $(this).siblings().show()
                    $(this).find('.nav-arrow-up').css({transform:'translateY(-20%) rotate(315deg)',transition:'all .35s ease-in-out'})
                    prodUl = false
                }else {
                    $(this).siblings().hide()
                    $(this).find('.nav-arrow-up').css({transform:'translateY(-50%) rotate(135deg)'})
                    prodUl = true
                }
            })
            setTimeout(function () {
                $('.navbar-collapse').children('#logo-part-for-pc').remove()
                $('.collapse').css({height:0,overflow:'hidden',border:'none'}).show()
                $('#logo-part-for-mobile').show()

            }, 800)
        }else{
            setTimeout(function () {

            },800)
        }


        //手机屏下的导航显示
        var toggleState = true
        $('.navbar-toggle').on('click',function () {
            if(toggleState){
                $('.navbar-collapse').css({transform:'scaleY(1)',transformOrigin:'top',transition: 'all .35s ease'})
                if($('.prod-center ul').css('display') === 'block') {
                    setTimeout(function () {
                        $('.navbar-collapse').css({height:'350px'})
                    }, 380)
                }
                toggleState = false
            }else{
                $('.navbar-collapse').css({transform:'scaleY(0)',transformOrigin:'top',transition: 'all .35s ease'})
                if($('.prod-center ul').css('display') === 'block') $('.prod-center ul').css('display') === 'none'
                toggleState = true
            }
        })
        $('.prod-center').on('click',function () {
            if($('.prod-center ul').css('display') === 'block') $('.navbar-collapse').css({height:'350px'})
            else $('.navbar-collapse').css({height:'302px'})
        })

    })
</script>
<script>
    //页面加载完毕后执行
    window.onload = function () {
        //找六个个元素：demo，smallBox,foatBox,mark,bigfloatBox,imgs,
        var objDemo=document.getElementById("demo");
        var objSmallBox=document.getElementById("small-box");
        var objMarkBox=document.getElementById("mark");
        var objFloatBox=document.getElementById("float-box");
        var objBigBox=document.getElementById("big-box");
        var objBigBoxImg=objBigBox.getElementsByTagName("img")[0];

        //给小盒子添加事件，移入和移出
        //移入：浮动的box和和bigBox显示
        objSmallBox.onmouseover=function(){
            objFloatBox.style.display="block";
            objBigBox.style.display="block";
        }
        //移除：浮动的box和bigBox隐藏
        objSmallBox.onmouseout=function(){
            objFloatBox.style.display="none";
            objBigBox.style.display="none";
        }

        //给小盒子添加鼠标移动事件
        objMarkBox.onmousemove=function(ev){
            var _event=ev||window.event;//做兼容性，兼容IE
            var sb = objSmallBox.getBoundingClientRect()

            //1计算值：
            var left = _event.clientX - sb.left;
            var top = _event.clientY - sb.top;

            /*//1计算值：
            var left=_event.clientX-objDemo.offsetLeft-objSmallBox.offsetLeft-objFloatBox.offsetWidth/2;
            var top=_event.clientY-objDemo.offsetTop-objSmallBox.offsetTop-objFloatBox.offsetHeight/2;*/

            //5.优化，在前面加判断,不让其溢出，加判断
            if(left<0 || left < objFloatBox.offsetWidth/2) left=0;
            if(left >= objFloatBox.offsetWidth/2) {
                left -= objFloatBox.offsetWidth/2;
            }
            if(objSmallBox.offsetWidth - left < objFloatBox.offsetWidth) {
                left = objSmallBox.offsetWidth-objFloatBox.offsetWidth;
            }

            if(top<0 || top < objFloatBox.offsetHeight/2) top=0;
            if(top >= objFloatBox.offsetHeight/2) {
                top -= objFloatBox.offsetHeight/2;
            }
            if(objSmallBox.offsetHeight - top < objFloatBox.offsetHeight) {
                top = objSmallBox.offsetHeight-objFloatBox.offsetHeight;
            }
            /*if(left>objSmallBox.offsetWidth-objFloatBox.offsetWidth)
                left=objSmallBox.offsetWidth-objFloatBox.offsetWidth;
            if(top>objSmallBox.offsetHeight-objFloatBox.offsetHeight)
                top=objSmallBox.offsetHeight-objFloatBox.offsetHeight;*/

            //2把值赋值给放大镜
            objFloatBox.style.left=left+"px";
            objFloatBox.style.top=top+"px";

            //3计算比例
            var percentX=left/(objMarkBox.offsetWidth-objFloatBox.offsetWidth);
            var percentY=top/(objMarkBox.offsetHeight-objFloatBox.offsetHeight);

            //4利用这个比例计算距离后赋值给右侧的图片
            objBigBoxImg.style.left=-percentX*(objBigBoxImg.offsetWidth-objBigBox.offsetWidth)+"px";
            objBigBoxImg.style.top=-percentY*(objBigBoxImg.offsetHeight-objBigBox.offsetHeight)+"px";
        }

    }
</script>
</html>